package com.lsh.airticket.service.imp;

import com.lsh.airticket.dao.PassengerDao;
import com.lsh.airticket.entity.Passenger;
import com.lsh.airticket.service.PassengerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * @author lsh
 * @date 2021/2/19
 **/
@Service
public class PassengerServiceImpl implements PassengerService {

    @Autowired
    PassengerDao passengerDao;

    @Override
    public int addPassenger(Passenger passenger) {
        return passengerDao.insertTbPassenger(passenger);
    }

    @Override
    public List<Passenger> findPassengerByUserId(Integer userId) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("userId", userId);
        List<Passenger> passengerList = passengerDao.findTbPassengerByCondition(map);
        return passengerList;
    }
}
